1. Field of the Invention
The present invention is directed to computer systems; and more particularly, it is directed to the editing of digital images using computer systems.
2. Description of the Related Art
Digital image editing is the process of creating and/or modifying digital images using a computer system. Using specialized software programs, users may manipulate and transform images in a variety of ways. These digital image editors may include programs of differing complexity such as limited-purpose programs associated with acquisition devices (e.g., digital cameras and scanners with bundled or built-in programs for managing brightness and contrast); limited bitmap editors suitable for relatively simple operations such as rotating and cropping images; and professional-grade programs such as Adobe Photoshop®, Adobe Illustrator®, and Adobe AfterEffects® (all available from Adobe Systems, Inc.) with large and complex feature sets.
Digital images may include raster graphics, vector graphics, or a combination thereof. Raster graphics data (also referred to herein as bitmaps) may be stored and manipulated as a grid of individual picture elements called pixels. Suitable image editors may be used to modify pixels (e.g., values such as hue, brightness, saturation, transparency, etc.) on a pixel-by-pixel basis or as a group. A bitmap may be characterized by its width and height in pixels and also by the number of bits per pixel. Commonly, a color bitmap defined in the RGB (red, green blue) color space may comprise between one and eight bits per pixel for each of the red, green, and blue channels. An alpha channel may be used to store additional data such as per-pixel transparency values. A black and white bitmap may require less space (e.g., one bit per pixel). Raster graphics are often used for photographs and photo-realistic images.
Vector graphics data may be stored and manipulated as one or more geometric objects. The geometric primitives (e.g., points, lines, polygons, Bézier curves, and text characters) may be based upon mathematical equations to represent parts of digital images. Suitable image editors may be used to perform operations on these objects such as rotation, translation, stretching, skewing, changing depth order, and combining with other objects. Vector graphics are often rasterized, or converted to raster graphics data, in the process of displaying the data on a display device or printing the data with a printer. While raster graphics may often lose apparent quality when scaled to a higher resolution, vector graphics may scale to the resolution of the device on which they are ultimately rendered. Therefore, vector graphics are often used for images that are sought to be device-independent, such as in typesetting and graphic design.
Many digital image editing operations may be applied selectively to a portion of the digital image. In selecting a portion of the digital image, a mask may be used to define a portion of a digital image on which an operation is sought to be performed. In general, a mask may comprise any image having a single color channel (e.g., a grayscale image). As used herein, a mask used in raster graphics is referred to as a “raster image mask.”
Masks may be used for various purposes. For example, an alpha channel may be a raster image mask which is used to form one component of a color image or the single component of a grayscale image. A layer mask may be used to modulate the blending of two layers (e.g., by removing or “masking” a portion of one or more layers from the final image). Suitable operations may be applied to modify the mask. For example, various filters (e.g., Gaussian blur, median filter, add noise, reduce noise, fragment, unsharp mask), image adjustments (e.g., levels, curves, brightness/contrast, shadow/highlight), and other operations (e.g., resizing, cropping, thresholding, rotation, perspective distortion) may be applied to masks.
A hard mask may represent a binary, “all or nothing” inclusion or exclusion of pixels. A soft mask may comprise a raster image mask having some intermediate values which lie between the minimum and maximum values for membership in the mask. For example, a soft mask may potentially comprise integer values between 0 and 255 or floating-point values between 0 and 1. Soft masks may be used for gradual blending of selected pixels into surrounding regions of the digital image. For example, a soft mask may be used in applying a feathered brushstroke in a digital image.
A selection may represent a region of interest in the digital image and may include one or more pixels (comprising one or more color channels) and/or geometric objects. A selection may be represented by a raster image mask having a single channel indicating per-pixel membership in the selection. If the mask is a soft mask, then the selection may have elements with partial membership (e.g., feathered edges) indicated by an intermediate value in the raster image mask. In most digital image editors, selections may be generated in various ways. For example, a marquee tool may permit the selection of rectangular or elliptical areas in an image. A lasso tool may allow the user to draw a freehand selection area. A magic wand tool may permit the selection of parts of an image based on a color range of pixels. Facilities such as edge detection, masking, alpha compositing, and color and channel-based extraction may also be used to generate selections. The pixels and/or objects in the selection may be contiguous or non-contiguous. Suitable operations may be applied to modify the selection itself. For example, a border operation may produce a selection that borders the edges of the original selection. Expand and contract operations may respectively make the selection larger or smaller. A smooth operation may smooth out irregularities in the selection. A feather operation may add softness to the edges of the selection.
In applying various types of soft masks to a digital image (e.g., selections, brush strokes, etc.), tools with additive or subtractive properties may be used. For example, selection tools may operate in combination modes such as “add to selection,” “subtract from selection,” and “intersect with selection.” Using a prior approach, however, repeated strokes of the tool over the same part of the image may cause the resulting mask to expand in size at the site of the overlap with each additional stroke. Therefore, this approach is not idempotent because repetition of the same operation does not yield the same result every time.